# -*- coding:latin-1 -*-

########################################################
# Date: 05/04/10                                       #
# Auteurs: Boris Burgarella & Rigaut Maximilien        #
# Nom: Gomoku                                          #
# Version: 1.0                                         #
# Copyright 2010: Rigaut Maximilien & Burgarella Boris #
########################################################
#    This file is part of Gomoku.
#
#    Gomoku is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    Gomoku is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with Gomoku.  If not, see <http://www.gnu.org/licenses/>.
#######################################################
# LICENCE                                             #
#######################################################
print """
+------------------------------------------------------------------+
| Gomoku Copyright (C) 2010 Boris Burgarella & Rigaut Maximilien   |
| Ce programme vient SANS ABSOLUMENT AUCUNE GARANTIE.              |
| Ceci est un logiciel libre et vous êtes invité à le redistribuer |
| suivant certaines conditions.                                    |
+------------------------------------------------------------------+
"""
#======================+
#  Modules             |
#----------------------+

import os,sys
import time,datetime
nomApp="Gomoku"

#- - - - - - - - - - - -
cwd=os.getcwd()
sys.path.append(cwd+'/Modules')
sys.path.append(cwd+'/Preferences')
sys.path.append(cwd+'/Graphix')
#- - - - - - - - - - - -

#----------------------+
# Initialisation       |
#- - - - - - - - - - - +
def dp(txt):
    if debug:
        print txt

langue,preset,taille,tailleCarreau,apparence,colors,starts,level=0,0,0,0,0,0,0,0
tour=0
time_0,time_F=0,0
game=True
preferenceWindow=False
debug=False
playedCases=[]
# Initialisation des tables IA
case=[0]
TQTPL=[0]       # L'ensemble des quintuplets: A chaque quintuplet on associe un UNIQUE indice.
C2QTPL=[0]      # Liste de liste de numeros de quintuples: Initialisation
#--- - - - - - - - - - - -
dp("Ouverture du module IA")
execfile('./Modules/IAgomoko.py')

#--- - - - - - - - - - - -
dp("Definition du Directory: Preferences")
filePref="./Preferences/preference.dat"

#--- - - - - - - - - - - 
dp("Execution du module de chargement")
execfile('./Modules/loadModule.py')

#--- - - - - - - - - - - -
dp("Chargement des variable")
loadPrefs()

#--- - - - - - - - - - - -
dp("Definition des Directories")
nomLangue=langue['languageShort']
fileThanks="./Ressources/"+nomLangue+'/'+langue['thanks']+'.txt'
fileLicence="./Ressources/"+nomLangue+'/'+langue['copyleft']+'.txt'
fileHelp="./Ressources/"+nomLangue+'/'+langue['help']+'.txt'

#--- - - - - - - - - - - -
dp("Chargement du module graphique")
execfile('./Modules/Graphix.py')

#======================+
#  Fonctions internes  |
#----------------------+

#======================+
#  Programme principal |
#----------------------+
#----------------------+
# Initialisation       |
#- - - - - - - - - - - +

#--- - - - - - - - - - - -
dp("Chargement du programme principal")

#--- - - - - - - - - - - -
dp("Re-Chargement des variable")
#loadPrefs()
#changePref("level","1.")


#--- - - - - - - - - - - -
dp("Lancement de l'interface")


#print readHighscore()
Application=morpion()
Application.mainloop()

#- - - - - - - - - - - -
dp("Sauvegarde des parametres")
savePrefs()
if debug:
    savePyBackup()

#-----------------------+
# Fin du programme      |
#-----------------------+